package com.gao.api.gate.quick.proto.http;

import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.cookie.Cookie;

import java.net.SocketAddress;
import java.util.Collection;
import java.util.Map;

/**
 * <p></p>
 *
 * @author gaoshuangwen
 * @since 2022/01/08 14:40
 */
public interface Request extends Message{

    RequestContext getContext();

    String requestIdent();

    String version();

    HttpMethod method();

    String uri();

    String scheme();

    default HttpParams params(){
        return HttpParams.parse(uri());
    }

    default Collection<String> getParams(String parName) {
        return params().get(parName);
    }
    Headers headers();

    default void addHeader(String key,String value){
        headers().add(key,value);
    }

    default Collection<String> getHeaders(String key) {
        return headers().get(key);
    }

    Map<String, Cookie> cookies();

    default Cookie getCookie(String name) {
        return cookies().get(name);
    }

    SocketAddress remoteAddress();

    SocketAddress localAddress();
}
